// ValidationAspects
// Written by Mike Saunders
// Released under Microsoft Public License (Ms-PL)
using System.Collections.Generic;
using System.Linq;
using ValidationAspects.Sdk;

namespace ValidationAspects
{
	public class ValidationResult
	{
		private readonly ValidationException _exception;

		internal ValidationResult() {}

		internal ValidationResult(ValidationException exception)
		{
			Enforce.IsNotNull(exception, "exception");
			_exception = exception;
		}

		public bool IsValid
		{
			get { return _exception == null; }
		}

		public IEnumerable<string> Messages
		{
			get { return _exception == null ? Enumerable.Empty<string>() : _exception.Messages; }
		}

		public ValidationException ValidationException
		{
			get { return _exception; }
		}
	}
}